<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <link href="bootstrap-4.6.1-dist/css/bootstrap.min.css"
          rel="stylesheet" type="text/css">
    <style type="text/css">
        body{
            width:100%;
            height:100%;
            background:url(img/1.jpg);
            background-repeat: no-repeat;
            background-size:100% 100%;
            background-attachment:fixed;
        }

        #main{

            margin-top: 100px;
            margin-left: 500px;
            margin-right: 500px;
            background-color: rgba(240, 240, 240, 0.33);
            padding-top:40px;
            padding-left: 60px;
            padding-right: 10px;
            padding-bottom: 30px;
            box-sizing:border-box;
        }
        .font{
            font-family: 楷体;
            font-weight: 600;
            font-size:25px;
        }

    </style>
</head>
<body>
<div id="main">
    <form id="form">
        <div class="form-group row">
            <label class="col-form-label col-4"></label>
            <div class="font">管理员注册</div>
        </div>
        <div class="form-group row">
            <label class="col-form-label col-2 text-center">账号:</label>
            <div class="col-8">
                <input type="text" name="loginName" class="form-control">
            </div>
        </div>
        <div class="form-group row">
            <label class="col-form-label col-2 text-center">密码：</label>
            <div class="col-8">
                <input type="password" name="loginPwd" class="form-control">
            </div>
        </div>
        <div class="form-group row">
            <label class="col-form-label col-2 text-center">性别:</label>
            <div class="col-8">
                <select name="userSex" class="form-control">
                    <option value="1">男</option>
                    <option value="2">女</option>
                </select>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-form-label col-2 text-center">姓名：</label>
            <div class="col-8">
                <input type="text" name="userName" class="form-control" placeholder="用户真实姓名">
            </div>
        </div>
        <div class="form-group row">
            <label class="col-form-label col-2 text-center">邮箱：</label>
            <div class="col-8">
                <input type="text" name="userEmail" class="form-control" placeholder="验证邮箱">
            </div>

        </div>
        <div class="form-group row">
            <label class="col-form-label col-2 text-center">生日：</label>
            <div class="col-8">
                <input type="date" name="userBirthday" class="form-control" placeholder="请选择生日">
            </div>

        </div>
        <div class="form-group row">
            <label class="col-form-label col-2"></label>
            <div class="col-8">

                <button type="button" id="btnReg" class="btn btn-lg btn-info">注册</button>
                <button type="reset" class="btn btn-lg btn-danger">重置</button>
             <a href="http://localhost:8088/demo/login.html">返回</a>
            </div>

        </div>
    </form>
</div>
</body>
<script src="jQuery/jquery-3.6.0.min.js"></script>
<script>
    jQuery(function () {
        jQuery("#btnReg").click(function () {

            let form=jQuery("#form").serialize();

             jQuery.post("user/reg",form,function (rst) {
               if(rst>0){
                   alert("注册成功！");
                   window.location.href="login.html";
               }
               else
               {
                   alert("注册失败！");
               }


             });

        });

    })
</script>
</html>